<?php
	/**
	 * The abstract TableFileTransferGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableFileTransfer subclass which
	 * extends this TableFileTransferGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableFileTransfer class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserIdFrom the value for intUserIdFrom (Not Null)
	 * @property integer $UserIdTo the value for intUserIdTo (Not Null)
	 * @property integer $ProjectId the value for intProjectId (Not Null)
	 * @property string $Name the value for strName (Not Null)
	 * @property string $Type the value for strType (Not Null)
	 * @property integer $Size the value for intSize (Not Null)
	 * @property string $Contents the value for strContents 
	 * @property string $Message the value for strMessage 
	 * @property QDateTime $UploadDate the value for dttUploadDate 
	 * @property QDateTime $DownloadDate the value for dttDownloadDate 
	 * @property QDateTime $DeleteDate the value for dttDeleteDate 
	 * @property string $Deleted the value for strDeleted (Not Null)
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property TableProject $Project the value for the TableProject object referenced by intProjectId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableFileTransferGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_file_transfer.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.user_id_from
		 * @var integer intUserIdFrom
		 */
		protected $intUserIdFrom;
		const UserIdFromDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.user_id_to
		 * @var integer intUserIdTo
		 */
		protected $intUserIdTo;
		const UserIdToDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.project_id
		 * @var integer intProjectId
		 */
		protected $intProjectId;
		const ProjectIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.name
		 * @var string strName
		 */
		protected $strName;
		const NameMaxLength = 200;
		const NameDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.type
		 * @var string strType
		 */
		protected $strType;
		const TypeMaxLength = 30;
		const TypeDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.size
		 * @var integer intSize
		 */
		protected $intSize;
		const SizeDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.contents
		 * @var string strContents
		 */
		protected $strContents;
		const ContentsDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.message
		 * @var string strMessage
		 */
		protected $strMessage;
		const MessageDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.upload_date
		 * @var QDateTime dttUploadDate
		 */
		protected $dttUploadDate;
		const UploadDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.download_date
		 * @var QDateTime dttDownloadDate
		 */
		protected $dttDownloadDate;
		const DownloadDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.delete_date
		 * @var QDateTime dttDeleteDate
		 */
		protected $dttDeleteDate;
		const DeleteDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.deleted
		 * @var string strDeleted
		 */
		protected $strDeleted;
		const DeletedMaxLength = 1;
		const DeletedDefault = null;


		/**
		 * Protected member variable that maps to the database column table_file_transfer.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = 0;


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_file_transfer.project_id.
		 *
		 * NOTE: Always use the Project property getter to correctly retrieve this TableProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableProject objProject
		 */
		protected $objProject;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableFileTransfer from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableFileTransfer::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableFileTransfer()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableFileTransfers
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableFileTransfer::QueryArray to perform the LoadAll query
			try {
				return TableFileTransfer::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableFileTransfers
		 * @return int
		 */
		public static function CountAll() {
			// Call TableFileTransfer::QueryCount to perform the CountAll query
			return TableFileTransfer::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();

			// Create/Build out the QueryBuilder object with TableFileTransfer-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_file_transfer');
			TableFileTransfer::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_file_transfer');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableFileTransfer object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableFileTransfer the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFileTransfer::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableFileTransfer object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableFileTransfer::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableFileTransfer::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableFileTransfer objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableFileTransfer[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFileTransfer::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableFileTransfer::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableFileTransfer objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableFileTransfer::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();

			$strQuery = TableFileTransfer::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tablefiletransfer', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableFileTransfer::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableFileTransfer
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_file_transfer';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id_from', $strAliasPrefix . 'user_id_from');
			$objBuilder->AddSelectItem($strTableName, 'user_id_to', $strAliasPrefix . 'user_id_to');
			$objBuilder->AddSelectItem($strTableName, 'project_id', $strAliasPrefix . 'project_id');
			$objBuilder->AddSelectItem($strTableName, 'name', $strAliasPrefix . 'name');
			$objBuilder->AddSelectItem($strTableName, 'type', $strAliasPrefix . 'type');
			$objBuilder->AddSelectItem($strTableName, 'size', $strAliasPrefix . 'size');
			$objBuilder->AddSelectItem($strTableName, 'contents', $strAliasPrefix . 'contents');
			$objBuilder->AddSelectItem($strTableName, 'message', $strAliasPrefix . 'message');
			$objBuilder->AddSelectItem($strTableName, 'upload_date', $strAliasPrefix . 'upload_date');
			$objBuilder->AddSelectItem($strTableName, 'download_date', $strAliasPrefix . 'download_date');
			$objBuilder->AddSelectItem($strTableName, 'delete_date', $strAliasPrefix . 'delete_date');
			$objBuilder->AddSelectItem($strTableName, 'deleted', $strAliasPrefix . 'deleted');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableFileTransfer from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableFileTransfer::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableFileTransfer
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableFileTransfer object
			$objToReturn = new TableFileTransfer();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id_from', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id_from'] : $strAliasPrefix . 'user_id_from';
			$objToReturn->intUserIdFrom = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id_to', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id_to'] : $strAliasPrefix . 'user_id_to';
			$objToReturn->intUserIdTo = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_id'] : $strAliasPrefix . 'project_id';
			$objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name';
			$objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'type'] : $strAliasPrefix . 'type';
			$objToReturn->strType = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'size', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'size'] : $strAliasPrefix . 'size';
			$objToReturn->intSize = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'contents', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'contents'] : $strAliasPrefix . 'contents';
			$objToReturn->strContents = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'message', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'message'] : $strAliasPrefix . 'message';
			$objToReturn->strMessage = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'upload_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'upload_date'] : $strAliasPrefix . 'upload_date';
			$objToReturn->dttUploadDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'download_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'download_date'] : $strAliasPrefix . 'download_date';
			$objToReturn->dttDownloadDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'delete_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'delete_date'] : $strAliasPrefix . 'delete_date';
			$objToReturn->dttDeleteDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'deleted', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'deleted'] : $strAliasPrefix . 'deleted';
			$objToReturn->strDeleted = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_file_transfer__';

			// Check for Project Early Binding
			$strAlias = $strAliasPrefix . 'project_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objProject = TableProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'project_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableFileTransfers from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableFileTransfer[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableFileTransfer::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableFileTransfer::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableFileTransfer object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableFileTransfer::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableFileTransfer()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by UserIdFrom Index(es)
		 * @param integer $intUserIdFrom
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByUserIdFrom($intUserIdFrom, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByUserIdFrom query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->UserIdFrom, $intUserIdFrom),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by UserIdFrom Index(es)
		 * @param integer $intUserIdFrom
		 * @return int
		*/
		public static function CountByUserIdFrom($intUserIdFrom) {
			// Call TableFileTransfer::QueryCount to perform the CountByUserIdFrom query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->UserIdFrom, $intUserIdFrom)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by UserIdTo Index(es)
		 * @param integer $intUserIdTo
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByUserIdTo($intUserIdTo, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByUserIdTo query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->UserIdTo, $intUserIdTo),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by UserIdTo Index(es)
		 * @param integer $intUserIdTo
		 * @return int
		*/
		public static function CountByUserIdTo($intUserIdTo) {
			// Call TableFileTransfer::QueryCount to perform the CountByUserIdTo query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->UserIdTo, $intUserIdTo)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByProjectId($intProjectId, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByProjectId query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->ProjectId, $intProjectId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @return int
		*/
		public static function CountByProjectId($intProjectId) {
			// Call TableFileTransfer::QueryCount to perform the CountByProjectId query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->ProjectId, $intProjectId)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by Name Index(es)
		 * @param string $strName
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByName($strName, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByName query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->Name, $strName),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by Name Index(es)
		 * @param string $strName
		 * @return int
		*/
		public static function CountByName($strName) {
			// Call TableFileTransfer::QueryCount to perform the CountByName query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->Name, $strName)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by Type Index(es)
		 * @param string $strType
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByType($strType, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByType query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->Type, $strType),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by Type Index(es)
		 * @param string $strType
		 * @return int
		*/
		public static function CountByType($strType) {
			// Call TableFileTransfer::QueryCount to perform the CountByType query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->Type, $strType)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by Size Index(es)
		 * @param integer $intSize
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayBySize($intSize, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayBySize query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->Size, $intSize),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by Size Index(es)
		 * @param integer $intSize
		 * @return int
		*/
		public static function CountBySize($intSize) {
			// Call TableFileTransfer::QueryCount to perform the CountBySize query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->Size, $intSize)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by UploadDate Index(es)
		 * @param QDateTime $dttUploadDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByUploadDate($dttUploadDate, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByUploadDate query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->UploadDate, $dttUploadDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by UploadDate Index(es)
		 * @param QDateTime $dttUploadDate
		 * @return int
		*/
		public static function CountByUploadDate($dttUploadDate) {
			// Call TableFileTransfer::QueryCount to perform the CountByUploadDate query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->UploadDate, $dttUploadDate)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by DownloadDate Index(es)
		 * @param QDateTime $dttDownloadDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByDownloadDate($dttDownloadDate, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByDownloadDate query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->DownloadDate, $dttDownloadDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by DownloadDate Index(es)
		 * @param QDateTime $dttDownloadDate
		 * @return int
		*/
		public static function CountByDownloadDate($dttDownloadDate) {
			// Call TableFileTransfer::QueryCount to perform the CountByDownloadDate query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->DownloadDate, $dttDownloadDate)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by DeleteDate Index(es)
		 * @param QDateTime $dttDeleteDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByDeleteDate($dttDeleteDate, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByDeleteDate query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->DeleteDate, $dttDeleteDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by DeleteDate Index(es)
		 * @param QDateTime $dttDeleteDate
		 * @return int
		*/
		public static function CountByDeleteDate($dttDeleteDate) {
			// Call TableFileTransfer::QueryCount to perform the CountByDeleteDate query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->DeleteDate, $dttDeleteDate)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by Deleted Index(es)
		 * @param string $strDeleted
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByDeleted($strDeleted, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByDeleted query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->Deleted, $strDeleted),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by Deleted Index(es)
		 * @param string $strDeleted
		 * @return int
		*/
		public static function CountByDeleted($strDeleted) {
			// Call TableFileTransfer::QueryCount to perform the CountByDeleted query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->Deleted, $strDeleted)
			);
		}
			
		/**
		 * Load an array of TableFileTransfer objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableFileTransfer[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call TableFileTransfer::QueryArray to perform the LoadArrayByStatus query
			try {
				return TableFileTransfer::QueryArray(
					QQ::Equal(QQN::TableFileTransfer()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableFileTransfers
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call TableFileTransfer::QueryCount to perform the CountByStatus query
			return TableFileTransfer::QueryCount(
				QQ::Equal(QQN::TableFileTransfer()->Status, $intStatus)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableFileTransfer
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_file_transfer` (
							`user_id_from`,
							`user_id_to`,
							`project_id`,
							`name`,
							`type`,
							`size`,
							`contents`,
							`message`,
							`upload_date`,
							`download_date`,
							`delete_date`,
							`deleted`,
							`status`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserIdFrom) . ',
							' . $objDatabase->SqlVariable($this->intUserIdTo) . ',
							' . $objDatabase->SqlVariable($this->intProjectId) . ',
							' . $objDatabase->SqlVariable($this->strName) . ',
							' . $objDatabase->SqlVariable($this->strType) . ',
							' . $objDatabase->SqlVariable($this->intSize) . ',
							' . $objDatabase->SqlVariable($this->strContents) . ',
							' . $objDatabase->SqlVariable($this->strMessage) . ',
							' . $objDatabase->SqlVariable($this->dttUploadDate) . ',
							' . $objDatabase->SqlVariable($this->dttDownloadDate) . ',
							' . $objDatabase->SqlVariable($this->dttDeleteDate) . ',
							' . $objDatabase->SqlVariable($this->strDeleted) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_file_transfer', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_file_transfer`
						SET
							`user_id_from` = ' . $objDatabase->SqlVariable($this->intUserIdFrom) . ',
							`user_id_to` = ' . $objDatabase->SqlVariable($this->intUserIdTo) . ',
							`project_id` = ' . $objDatabase->SqlVariable($this->intProjectId) . ',
							`name` = ' . $objDatabase->SqlVariable($this->strName) . ',
							`type` = ' . $objDatabase->SqlVariable($this->strType) . ',
							`size` = ' . $objDatabase->SqlVariable($this->intSize) . ',
							`contents` = ' . $objDatabase->SqlVariable($this->strContents) . ',
							`message` = ' . $objDatabase->SqlVariable($this->strMessage) . ',
							`upload_date` = ' . $objDatabase->SqlVariable($this->dttUploadDate) . ',
							`download_date` = ' . $objDatabase->SqlVariable($this->dttDownloadDate) . ',
							`delete_date` = ' . $objDatabase->SqlVariable($this->dttDeleteDate) . ',
							`deleted` = ' . $objDatabase->SqlVariable($this->strDeleted) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableFileTransfer
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableFileTransfer with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_file_transfer`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableFileTransfers
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_file_transfer`');
		}

		/**
		 * Truncate table_file_transfer table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableFileTransfer::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_file_transfer`');
		}

		/**
		 * Reload this TableFileTransfer from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableFileTransfer object.');

			// Reload the Object
			$objReloaded = TableFileTransfer::Load($this->intId);

			// Update $this's local variables to match
			$this->intUserIdFrom = $objReloaded->intUserIdFrom;
			$this->intUserIdTo = $objReloaded->intUserIdTo;
			$this->ProjectId = $objReloaded->ProjectId;
			$this->strName = $objReloaded->strName;
			$this->strType = $objReloaded->strType;
			$this->intSize = $objReloaded->intSize;
			$this->strContents = $objReloaded->strContents;
			$this->strMessage = $objReloaded->strMessage;
			$this->dttUploadDate = $objReloaded->dttUploadDate;
			$this->dttDownloadDate = $objReloaded->dttDownloadDate;
			$this->dttDeleteDate = $objReloaded->dttDeleteDate;
			$this->strDeleted = $objReloaded->strDeleted;
			$this->intStatus = $objReloaded->intStatus;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserIdFrom':
					/**
					 * Gets the value for intUserIdFrom (Not Null)
					 * @return integer
					 */
					return $this->intUserIdFrom;

				case 'UserIdTo':
					/**
					 * Gets the value for intUserIdTo (Not Null)
					 * @return integer
					 */
					return $this->intUserIdTo;

				case 'ProjectId':
					/**
					 * Gets the value for intProjectId (Not Null)
					 * @return integer
					 */
					return $this->intProjectId;

				case 'Name':
					/**
					 * Gets the value for strName (Not Null)
					 * @return string
					 */
					return $this->strName;

				case 'Type':
					/**
					 * Gets the value for strType (Not Null)
					 * @return string
					 */
					return $this->strType;

				case 'Size':
					/**
					 * Gets the value for intSize (Not Null)
					 * @return integer
					 */
					return $this->intSize;

				case 'Contents':
					/**
					 * Gets the value for strContents 
					 * @return string
					 */
					return $this->strContents;

				case 'Message':
					/**
					 * Gets the value for strMessage 
					 * @return string
					 */
					return $this->strMessage;

				case 'UploadDate':
					/**
					 * Gets the value for dttUploadDate 
					 * @return QDateTime
					 */
					return $this->dttUploadDate;

				case 'DownloadDate':
					/**
					 * Gets the value for dttDownloadDate 
					 * @return QDateTime
					 */
					return $this->dttDownloadDate;

				case 'DeleteDate':
					/**
					 * Gets the value for dttDeleteDate 
					 * @return QDateTime
					 */
					return $this->dttDeleteDate;

				case 'Deleted':
					/**
					 * Gets the value for strDeleted (Not Null)
					 * @return string
					 */
					return $this->strDeleted;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;


				///////////////////
				// Member Objects
				///////////////////
				case 'Project':
					/**
					 * Gets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @return TableProject
					 */
					try {
						if ((!$this->objProject) && (!is_null($this->intProjectId)))
							$this->objProject = TableProject::Load($this->intProjectId);
						return $this->objProject;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserIdFrom':
					/**
					 * Sets the value for intUserIdFrom (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intUserIdFrom = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UserIdTo':
					/**
					 * Sets the value for intUserIdTo (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intUserIdTo = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProjectId':
					/**
					 * Sets the value for intProjectId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objProject = null;
						return ($this->intProjectId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Name':
					/**
					 * Sets the value for strName (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strName = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Type':
					/**
					 * Sets the value for strType (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strType = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Size':
					/**
					 * Sets the value for intSize (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intSize = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Contents':
					/**
					 * Sets the value for strContents 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strContents = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Message':
					/**
					 * Sets the value for strMessage 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strMessage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UploadDate':
					/**
					 * Sets the value for dttUploadDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttUploadDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DownloadDate':
					/**
					 * Sets the value for dttDownloadDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttDownloadDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'DeleteDate':
					/**
					 * Sets the value for dttDeleteDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttDeleteDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Deleted':
					/**
					 * Sets the value for strDeleted (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strDeleted = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'Project':
					/**
					 * Sets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @param TableProject $mixValue
					 * @return TableProject
					 */
					if (is_null($mixValue)) {
						$this->intProjectId = null;
						$this->objProject = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved Project for this TableFileTransfer');

						// Update Local Member Variables
						$this->objProject = $mixValue;
						$this->intProjectId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableFileTransfer"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="UserIdFrom" type="xsd:int"/>';
			$strToReturn .= '<element name="UserIdTo" type="xsd:int"/>';
			$strToReturn .= '<element name="Project" type="xsd1:TableProject"/>';
			$strToReturn .= '<element name="Name" type="xsd:string"/>';
			$strToReturn .= '<element name="Type" type="xsd:string"/>';
			$strToReturn .= '<element name="Size" type="xsd:int"/>';
			$strToReturn .= '<element name="Contents" type="xsd:string"/>';
			$strToReturn .= '<element name="Message" type="xsd:string"/>';
			$strToReturn .= '<element name="UploadDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="DownloadDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="DeleteDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Deleted" type="xsd:string"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableFileTransfer', $strComplexTypeArray)) {
				$strComplexTypeArray['TableFileTransfer'] = TableFileTransfer::GetSoapComplexTypeXml();
				TableProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableFileTransfer::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableFileTransfer();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if (property_exists($objSoapObject, 'UserIdFrom'))
				$objToReturn->intUserIdFrom = $objSoapObject->UserIdFrom;
			if (property_exists($objSoapObject, 'UserIdTo'))
				$objToReturn->intUserIdTo = $objSoapObject->UserIdTo;
			if ((property_exists($objSoapObject, 'Project')) &&
				($objSoapObject->Project))
				$objToReturn->Project = TableProject::GetObjectFromSoapObject($objSoapObject->Project);
			if (property_exists($objSoapObject, 'Name'))
				$objToReturn->strName = $objSoapObject->Name;
			if (property_exists($objSoapObject, 'Type'))
				$objToReturn->strType = $objSoapObject->Type;
			if (property_exists($objSoapObject, 'Size'))
				$objToReturn->intSize = $objSoapObject->Size;
			if (property_exists($objSoapObject, 'Contents'))
				$objToReturn->strContents = $objSoapObject->Contents;
			if (property_exists($objSoapObject, 'Message'))
				$objToReturn->strMessage = $objSoapObject->Message;
			if (property_exists($objSoapObject, 'UploadDate'))
				$objToReturn->dttUploadDate = new QDateTime($objSoapObject->UploadDate);
			if (property_exists($objSoapObject, 'DownloadDate'))
				$objToReturn->dttDownloadDate = new QDateTime($objSoapObject->DownloadDate);
			if (property_exists($objSoapObject, 'DeleteDate'))
				$objToReturn->dttDeleteDate = new QDateTime($objSoapObject->DeleteDate);
			if (property_exists($objSoapObject, 'Deleted'))
				$objToReturn->strDeleted = $objSoapObject->Deleted;
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableFileTransfer::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objProject)
				$objObject->objProject = TableProject::GetSoapObjectFromObject($objObject->objProject, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intProjectId = null;
			if ($objObject->dttUploadDate)
				$objObject->dttUploadDate = $objObject->dttUploadDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttDownloadDate)
				$objObject->dttDownloadDate = $objObject->dttDownloadDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttDeleteDate)
				$objObject->dttDeleteDate = $objObject->dttDeleteDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableFileTransfer extends QQNode {
		protected $strTableName = 'table_file_transfer';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableFileTransfer';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserIdFrom':
					return new QQNode('user_id_from', 'UserIdFrom', 'integer', $this);
				case 'UserIdTo':
					return new QQNode('user_id_to', 'UserIdTo', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'Name':
					return new QQNode('name', 'Name', 'string', $this);
				case 'Type':
					return new QQNode('type', 'Type', 'string', $this);
				case 'Size':
					return new QQNode('size', 'Size', 'integer', $this);
				case 'Contents':
					return new QQNode('contents', 'Contents', 'string', $this);
				case 'Message':
					return new QQNode('message', 'Message', 'string', $this);
				case 'UploadDate':
					return new QQNode('upload_date', 'UploadDate', 'QDateTime', $this);
				case 'DownloadDate':
					return new QQNode('download_date', 'DownloadDate', 'QDateTime', $this);
				case 'DeleteDate':
					return new QQNode('delete_date', 'DeleteDate', 'QDateTime', $this);
				case 'Deleted':
					return new QQNode('deleted', 'Deleted', 'string', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableFileTransfer extends QQReverseReferenceNode {
		protected $strTableName = 'table_file_transfer';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableFileTransfer';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserIdFrom':
					return new QQNode('user_id_from', 'UserIdFrom', 'integer', $this);
				case 'UserIdTo':
					return new QQNode('user_id_to', 'UserIdTo', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'Name':
					return new QQNode('name', 'Name', 'string', $this);
				case 'Type':
					return new QQNode('type', 'Type', 'string', $this);
				case 'Size':
					return new QQNode('size', 'Size', 'integer', $this);
				case 'Contents':
					return new QQNode('contents', 'Contents', 'string', $this);
				case 'Message':
					return new QQNode('message', 'Message', 'string', $this);
				case 'UploadDate':
					return new QQNode('upload_date', 'UploadDate', 'QDateTime', $this);
				case 'DownloadDate':
					return new QQNode('download_date', 'DownloadDate', 'QDateTime', $this);
				case 'DeleteDate':
					return new QQNode('delete_date', 'DeleteDate', 'QDateTime', $this);
				case 'Deleted':
					return new QQNode('deleted', 'Deleted', 'string', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>